package com.hpjz.common;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;


public class ResultBean implements Serializable {

	private static final long serialVersionUID = 1L;
	/** 返回状态码 */
	private String status;
	/** 返回值 */
	private Object result;

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public ResultBean(Object result) {
		this.result = result;
	}

	public ResultBean(String status) {
		this.status = status;
	}

	public ResultBean(String status, Object result) {
		super();
		this.status = status;
		this.result = result;
		this.toString();
	}
	
	public String ResultBean(String status, Object result) {
		this.status = status;
		this.result = result;
		return this.toString();
	}

	public ResultBean() {
		super();
		
	}

	@Override
	public String toString() {
		String str = null;
		ObjectMapper mapper = new ObjectMapper();
		try {
			mapper.setSerializationInclusion(Include.NON_NULL);
			str = mapper.writeValueAsString(this);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str;
	}
}
